package com.zimin.cloud.system.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zimin.cloud.mine.pojo.system.business.RoleBO;
import com.zimin.cloud.system.biz.IRoleBiz;
import com.zimin.cloud.system.controller.api.IRoleController;
import com.zimin.cloud.system.pojo.entity.Role;
import com.zimin.shared.pojo.BaseController;
import com.zimin.shared.pojo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 角色信息 前端控制器
 * </p>
 *
 * @author zimin
 * @since 2021-12-30 11:05
 */
@RestController
public class RoleController extends BaseController implements IRoleController {

    @Autowired
    private IRoleBiz roleBiz;

    @Override
    public Result rolePageList(Page<Role> rolePage, RoleBO roleBO) {
        return result(roleBiz.pageRoleList(rolePage, roleBO));
    }

    @Override
    public Result allRole() {
        return result(roleBiz.allRole());
    }

    @Override
    public Result getRoleById(String roleId) {
        return result(roleBiz.getRoleVoById(roleId));
    }

    @Override
    public Result save(RoleBO roleBO) {
        return result(roleBiz.save(roleBO));
    }

    @Override
    public Result update(RoleBO roleBO) {
        return result(roleBiz.updateById(roleBO));
    }

    @Override
    public Result delete(List<String> idList) {
        return result(roleBiz.removeByIds(idList));
    }
}
